<?php if (!defined('THINK_PATH')) exit();?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<title><?php echo ($title); ?></title>
<link href="/yuyue_tp/Public/Mobile/css/form.css" rel="stylesheet" type="text/css">
<link href="/yuyue_tp/Public/Mobile/css/mDialog/mdialog.css" rel="stylesheet" type="text/css">
<style type="text/css">
#bottom_info {position: relative;top: -3.8em;margin: 0 0.5em;padding: .8em 0;text-align: center;background-color: #18c178;color: #ffffff;border: medium hidden;border-radius: 0.1em;box-sizing: border-box;display: none;}
#bottom_info a {width: 100%;text-decoration: none;outline: none;}
#bottom_jump {position: relative;top: -3em;margin: 0 0.5em;padding: .8em 0;text-align: center;background-color: #62A9E3;color: #ffffff;border: medium hidden;border-radius: 0.1em;box-sizing: border-box;display: none;}
</style>

</head>
<body>

<div id="subjects">
	<form id="yuyue_form">
		<div class="form_ctrl page_head" id="1" title="乳腺癌筛查预约" style="color: white; background-color: gray;">
            <h2><?php echo ($title); ?></h2>
		</div>
		<div class="form_ctrl page_text" id="2" title="">
			<p>为节省大家宝贵时间，特开始时间预约系统。</p>
		</div>
		<div class="form_ctrl input_text" id="3" title="姓名">
			<label class="ctrl_title">姓名</label>
			<input type="text" name="user" placeholder="请输入姓名">

		</div>
		<div class="form_ctrl input_text" id="4" title="联系电话">
			<label class="ctrl_title">联系电话</label>
			<input name="phone" type="text" size="11" maxlength="11" placeholder="请输入电话号码">
			<span id="messg"></span>
		</div>
		<div class="form_ctrl input_date" id="date_d" title="就诊日期">
			<label class="ctrl_title">预约日期</label>
			<?php if(is_array($datelist)): foreach($datelist as $key=>$vo): ?><p><label><input name="date_d" type="radio" class="select_goods" value="<?php echo ($key); ?>"><?php echo ($vo); ?></p></label><?php endforeach; endif; ?>
		</div>  
		<div class="form_ctrl input_date" id="6" title="就诊时间">
		  	<label class="ctrl_title">预约时间</label>
		  	<p>上午</p>
				  <p><label><input value="10:30" name="yueyueshijian" type="radio" class="select_goods"> A.10:30</label>
				  <label><input value="10:40" name="yueyueshijian" type="radio" class="select_goods"> B.10:40</label>
				  <label><input value="10:50" name="yueyueshijian" type="radio" class="select_goods"> C.10:50</label></p>
				  <p><label><input value="11:00" name="yueyueshijian" type="radio" class="select_goods"> D.11:00</label>
				  <label><input value="11:10" name="yueyueshijian" type="radio" class="select_goods"> E.11:10</label>
				  <label><input value="11:20" name="yueyueshijian" type="radio" class="select_goods"> F.11:20</label></p>
				  <p><label><input value="11:30" name="yueyueshijian" type="radio" class="select_goods"> G.11:30</label>
				  <label><input value="11:40" name="yueyueshijian" type="radio" class="select_goods"> H.11:40</label>
				  <label><input value="11:50" name="yueyueshijian" type="radio" class="select_goods"> I.11:50</label>
				  <p><label><input value="12:00" name="yueyueshijian" type="radio" class="select_goods"> J.12:00</label>
				  <label><input value="12:10" name="yueyueshijian" type="radio" class="select_goods"> K.12:10</label>
				  <label><input value="12:20" name="yueyueshijian" type="radio" class="select_goods"> L.12:20</label>
				  <p><label><input value="12:30" name="yueyueshijian" type="radio" class="select_goods"> M.12:30</label></p>
			<p>下午</p>
				  <label><input value="16:10" name="yueyueshijian" type="radio" class="select_goods"> N.16:10</label>
				  <label><input value="16:20" name="yueyueshijian" type="radio" class="select_goods"> O.16:20</label>
				  <label><input value="16:30" name="yueyueshijian" type="radio" class="select_goods"> P.16:30</label>
				  <p><label><input value="16:40" name="yueyueshijian" type="radio" class="select_goods"> Q.16:40</label>
				  <label><input value="16:50" name="yueyueshijian" type="radio" class="select_goods"> R.16:50</label>
				  <label><input value="17:00" name="yueyueshijian" type="radio" class="select_goods"> S.17:00</label></p>
				  <label><input value="17:10" name="yueyueshijian" type="radio" class="select_goods"> T.17:10</label>
		</div>
		<div class="form_ctrl form_submit" id="9" title="确定预约">
			<input type="button" id="form_but" value="点击按钮预约筛查" style="color: white; background-color: rgb(255, 108, 0);">
		</div>
	</form>	
</div>
<script src="/yuyue_tp/Public/Mobile/js/form.min.js" type="text/javascript"></script>
<script src="/yuyue_tp/Public/Mobile/js/jquery.min.js" type="text/javascript"></script>
<script src="/yuyue_tp/Public/Mobile/js/mDialog/mdialog.min.js" type="text/javascript"></script>
</body>
</html>
<script type="text/javascript">

$("#form_but").click(function(){
	var user = $("input[name='user']").val();
	var phone = checkphone($("input[name='phone']").val());
	if(phone === false) return;
	var date_d = $("input[name='date_d']:checked").val();
	alert(date_d);
	return;
	var date_h = $("select[name='date_h'] option:selected").val();
	if(date_d=='0' || date_h=='0'){
		mDialog('请选择日期与时间', {title: '警告!'});
		return;
	}
	$.post('<?php echo U("yuyue/bespoke");?>',{user:user,phone:phone,date_d:date_d,date_h:date_h},
		function(re){
			if(re.state){
				mDialog(re.msg, {title: '警告!'});
			}
		},
	'json');
});

$("input[name='phone']").blur(function(){
	$.post('<?php echo U("yuyue/checkUser");?>',{phone:$(this).val()},function(re){
		if(re.state){
			mDialog(re.msg, {title: '您已经预约过了！'});
		}
	});
});

$("input[name='date_d']").change(function(){
	$.getJSON('<?php echo U("yuyue/getTimeData");?>',{date_d:$(this).val()},function(re){
		var leng = re.length;
		for(var i=0;i<leng;i++){
			//由于re[i].length 无法统计出对象属性个数 同时
			//re[i]下面的是json对象，要用for in 遍历出对象的属性
			for(var col in re[i]){
				console.log(re[i][col]);
			}
			return ;
		}
	});
});

function checkphone(phone){
	var reg =/^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/;
    if(phone == ''){
    	mDialog('手机号码不能为空', {title: '警告!'});
    	return false;
    }
    var my=false;
    if (reg.test(phone))my=true;
    if (!my){
        mDialog('请输入正确的手机号码', {title: '警告!'});
        return false;
    }
    return phone;
}
</script>